define [
  'views/base/view'
  'alertify'
], (BaseView, alertify) ->

  'use strict'

  class BaseItemView extends BaseView

    # Override Attributtes
    # =============================================================

    tagName: 'tr'
    events:
      'click [name="delete"]': 'clickDeleteHandler'


    # Additional Attributtes
    # =============================================================

    removeConfirmMessage : 'Deseja remover esse registro?'
    removedMessage       : 'Registro removido'

    # Handler Events
    # =============================================================

    clickDeleteHandler: (event) ->
      event.preventDefault()

      alertify.confirm @removeConfirmMessage, (confirmed) =>
        if confirmed
          promise = @model.destroy wait: yes
          promise.done =>
            @publishEvent 'feedback:success', @removedMessage